package com.moli.iov.open.web.controller;

import com.moli.iov.base.model.dto.req.VehicleBaseAuthReqDto;
import com.moli.iov.base.remote.IVehicleBaseAuthRemoteService;
import com.moli.iov.open.model.vo.req.VehicleBaseAuthReqVo;
import com.moli.iov.rest.RestResponse;
import com.moli.iov.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/auth")
public class AuthController extends BaseController {

    @Reference(group = "${service.group}", check = false)
    private IVehicleBaseAuthRemoteService authRemoteService;

    @PostMapping("/update")
    public RestResponse updateVehicleBaseAuth(
            @RequestBody VehicleBaseAuthReqVo vo) {
        assembleUserInfo(vo);
        VehicleBaseAuthReqDto dto = new VehicleBaseAuthReqDto();
        CommonUtils.copyProperties(vo, dto);
        return authRemoteService.updateVehicleBaseAuth(dto);
    }
}
